<template>
<div class="layerRtb layerRtb-threecolumn">
    <three-title :title="{name:'过程'}"></three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "137">
        <div class="analyItem" v-for="(item,index) in processList" :key="index">
            <p class="analyItemTit tx-center"  :data-title ="item.proname">{{item.proname | slice(0,4)}}</p>
            <div class="analyItemCon">
                <p class="col-md-6">
                    <span class="cLightGray pr8">可用余额</span>
                    <span>{{item.userfulMoney}}</span>
                </p>
                <p class="col-md-6">
                    <span class="cLightGray pr8">待回款</span>
                    <span>{{item.returnMoney |toFixed(2)}}</span>
                </p>
            </div>
        </div>
    </div>
    <div class="layerRtb-footer">
        <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
              <p class="col-md-6">
                    <span class="cLightGray pr8">可结算</span>
                    <span>{{processYCount |toFixed(2)}}</span>
                </p>
                <p class="col-md-6">
                    <span class="cLightGray pr8">待收尾款</span>
                    <span>{{processDCount |toFixed(2)}}</span>
                </p>
            </div>
        </div>
    </div>
</div>
</template>
<script>
export default {
    data () {
        return {
            processList: []
        }
    },
    created () {
        this.processList = this.$route.query.processList
    },
    methods: {

    },
    watch: {
        $route () {
            this.processList = this.$route.query.processList
        }
    },
    computed: {
        processDCount () {
            if (this.processList && this.processList.length > 0) {
                return this.processList.map(startReady => startReady.returnMoney).reduce((acc, cur) => (parseFloat(cur) + acc), 0)
            } else {
                return 0
            }
        },
        processYCount () {
            if (this.processList && this.processList.length > 0) {
                return this.processList.map(startReady => startReady.userfulMoney).reduce((acc, cur) => (parseFloat(cur) + acc), 0)
            } else {
                return 0
            }
        }
    }
}
</script>
